home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / mtc / mtcsetup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-02  |  7.8 KB  |  247 lines

  1. VERSION 2.00
  2. Begin Form MidiForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "MIDI Setup"
  6.    ClientHeight    =   2730
  7.    ClientLeft      =   2295
  8.    ClientTop       =   2505
  9.    ClientWidth     =   4230
  10.    ControlBox      =   0   'False
  11.    Height          =   3135
  12.    Left            =   2235
  13.    LinkTopic       =   "Form2"
  14.    MaxButton       =   0   'False
  15.    MinButton       =   0   'False
  16.    ScaleHeight     =   2730
  17.    ScaleWidth      =   4230
  18.    Top             =   2160
  19.    Width           =   4350
  20.    Begin SSPanel Z 
  21.       AutoSize        =   3  'AutoSize Child To Panel
  22.       BackColor       =   &H00C0C0C0&
  23.       BevelInner      =   1  'Inset
  24.       BevelOuter      =   0  'None
  25.       BevelWidth      =   3
  26.       BorderWidth     =   0
  27.       Font3D          =   0  'None
  28.       ForeColor       =   &H00FF0000&
  29.       Height          =   555
  30.       Index           =   10
  31.       Left            =   1530
  32.       TabIndex        =   2
  33.       Top             =   2010
  34.       Width           =   1095
  35.       Begin SSCommand cmdOK 
  36.          BevelWidth      =   3
  37.          Caption         =   "&OK"
  38.          Font3D          =   0  'None
  39.          ForeColor       =   &H00FF0000&
  40.          Height          =   465
  41.          Left            =   45
  42.          Outline         =   0   'False
  43.          TabIndex        =   3
  44.          Top             =   45
  45.          Width           =   1005
  46.       End
  47.    End
  48.    Begin SSPanel Z 
  49.       Alignment       =   6  'Center - TOP
  50.       BackColor       =   &H00C0C0C0&
  51.       BevelInner      =   2  'Raised
  52.       BevelOuter      =   0  'None
  53.       BevelWidth      =   2
  54.       BorderWidth     =   0
  55.       Caption         =   "MIDI Out Device"
  56.       Font3D          =   3  'Inset w/light shading
  57.       FontBold        =   -1  'True
  58.       FontItalic      =   0   'False
  59.       FontName        =   "MS Sans Serif"
  60.       FontSize        =   9.75
  61.       FontStrikethru  =   0   'False
  62.       FontUnderline   =   0   'False
  63.       ForeColor       =   &H00FF0000&
  64.       Height          =   795
  65.       Index           =   1
  66.       Left            =   150
  67.       TabIndex        =   1
  68.       Top             =   1050
  69.       Width           =   3915
  70.       Begin SSPanel Z 
  71.          Alignment       =   6  'Center - TOP
  72.          AutoSize        =   3  'AutoSize Child To Panel
  73.          BackColor       =   &H00C0C0C0&
  74.          BevelInner      =   1  'Inset
  75.          BevelOuter      =   0  'None
  76.          BevelWidth      =   2
  77.          BorderWidth     =   0
  78.          Font3D          =   3  'Inset w/light shading
  79.          ForeColor       =   &H00FF0000&
  80.          Height          =   360
  81.          Index           =   3
  82.          Left            =   120
  83.          TabIndex        =   6
  84.          Top             =   300
  85.          Width           =   3645
  86.          Begin ComboBox OutList 
  87.             Height          =   300
  88.             Left            =   30
  89.             Style           =   2  'Dropdown List
  90.             TabIndex        =   7
  91.             TabStop         =   0   'False
  92.             Top             =   30
  93.             Width           =   3585
  94.          End
  95.       End
  96.    End
  97.    Begin SSPanel Z 
  98.       Alignment       =   6  'Center - TOP
  99.       BackColor       =   &H00C0C0C0&
  100.       BevelInner      =   2  'Raised
  101.       BevelOuter      =   0  'None
  102.       BevelWidth      =   2
  103.       BorderWidth     =   0
  104.       Caption         =   "MIDI In Device"
  105.       Font3D          =   3  'Inset w/light shading
  106.       FontBold        =   -1  'True
  107.       FontItalic      =   0   'False
  108.       FontName        =   "MS Sans Serif"
  109.       FontSize        =   9.75
  110.       FontStrikethru  =   0   'False
  111.       FontUnderline   =   0   'False
  112.       ForeColor       =   &H00FF0000&
  113.       Height          =   765
  114.       Index           =   0
  115.       Left            =   150
  116.       TabIndex        =   0
  117.       Top             =   150
  118.       Width           =   3915
  119.       Begin SSPanel Z 
  120.          Alignment       =   6  'Center - TOP
  121.          AutoSize        =   3  'AutoSize Child To Panel
  122.          BackColor       =   &H00C0C0C0&
  123.          BevelInner      =   1  'Inset
  124.          BevelOuter      =   0  'None
  125.          BevelWidth      =   2
  126.          BorderWidth     =   0
  127.          Font3D          =   3  'Inset w/light shading
  128.          ForeColor       =   &H00FF0000&
  129.          Height          =   360
  130.          Index           =   2
  131.          Left            =   120
  132.          TabIndex        =   4
  133.          Top             =   300
  134.          Width           =   3645
  135.          Begin ComboBox InList 
  136.             Height          =   300
  137.             Left            =   30
  138.             Style           =   2  'Dropdown List
  139.             TabIndex        =   5
  140.             TabStop         =   0   'False
  141.             Top             =   30
  142.             Width           =   3585
  143.          End
  144.       End
  145.    End
  146. Option Explicit
  147. Sub CmdOK_Click ()
  148.     Midi_SaveIni
  149.     Hide
  150. End Sub
  151. Sub Form_Activate ()
  152.     Midi_LoadIni
  153. End Sub
  154. Sub Form_Load ()
  155.      Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
  156. End Sub
  157. Sub InList_Click ()
  158.     If InList.ListIndex > -1 Then
  159.         InDevice = InList.ListIndex
  160.         MidiIn_Open (InDevice)
  161.     End If
  162. End Sub
  163. Sub Midi_LoadIni ()
  164.     Dim FileData, Msg As String, ap As String
  165.     Dim Fnum, ii, jj
  166.     On Error GoTo Midi_LoadIniError
  167.     Fnum = FreeFile     'MTC.INI ha d'estar
  168.                         'al mateix directori que l'aplicaci
  169.     ap = App.Path
  170.     If Right$(ap, 1) <> "\" Then ap = ap & "\"
  171.     Open ap & "MTC.INI" For Input As Fnum
  172.     jj = 1
  173.     Do While Not EOF(Fnum)
  174.         Line Input #Fnum, FileData
  175.         If Left$(FileData, 1) = "*" Then
  176.             ii = Mid$(FileData, 2)
  177.             Select Case jj
  178.                 Case 1
  179.                     OutDevice = Val(ii)
  180.                     If MidiForm.OutList.ListCount > OutDevice + 1 Then
  181.                         MidiForm.OutList.ListIndex = OutDevice + 1
  182.                     Else
  183.                         OutDevice = -2
  184.                         MidiForm.OutList.ListIndex = -1
  185.                     End If
  186.                 Case 2
  187.                     InDevice = Val(ii)
  188.                     If MidiForm.InList.ListCount > InDevice Then
  189.                         MidiForm.InList.ListIndex = InDevice
  190.                     Else
  191.                         InDevice = -1
  192.                         MidiForm.InList.ListIndex = -1
  193.                     End If
  194.             End Select
  195.             jj = jj + 1
  196.         End If
  197.     Loop
  198. Midi_LoadIniEnd:
  199.     Close Fnum
  200.     Exit Sub
  201. Midi_LoadIniError:
  202.     'Valors per defecte
  203.     If MidiForm.OutList.ListCount > 0 Then
  204.         MidiForm.OutList.ListIndex = 0
  205.         OutDevice = -1
  206.     Else
  207.         MidiForm.OutList.ListIndex = -1
  208.         OutDevice = -2
  209.     End If
  210.     If MidiForm.InList.ListCount > 0 Then
  211.         MidiForm.InList.ListIndex = 0
  212.         InDevice = 0
  213.     Else
  214.         MidiForm.InList.ListIndex = -1
  215.         InDevice = -1
  216.     End If
  217.     Resume Midi_LoadIniEnd
  218. End Sub
  219. Sub Midi_SaveIni ()
  220.     Dim Msg As String, ap As String
  221.     Dim Fnum, i
  222.     On Error GoTo Midi_SaveIniError
  223.     Fnum = FreeFile
  224.     ap = App.Path
  225.     If Right$(ap, 1) <> "\" Then ap = ap & "\"
  226.     Open ap & "MTC.INI" For Output As Fnum    'If file doesn't exists it's created
  227.     Print #Fnum, "[MidiOut Device]"
  228.     Print #Fnum, "*" & Format$(OutDevice)
  229.     Print #Fnum,
  230.     Print #Fnum, "[MidiIn Device]"
  231.     Print #Fnum, "*" & Format$(InDevice)
  232.     Print #Fnum,
  233. Midi_SaveIniEnd:
  234.     Close Fnum
  235.     Exit Sub
  236. Midi_SaveIniError:
  237.     Msg = "'MTC.INI' not created!"
  238.     Dlg_Alert Msg
  239.     Resume Midi_SaveIniEnd
  240. End Sub
  241. Sub OutList_Click ()
  242.     If OutList.ListIndex > -1 Then
  243.         OutDevice = OutList.ListIndex - 1
  244.         MidiOut_Open (OutDevice)
  245.     End If
  246. End Sub
  247.